X-Axis Rotation Matrix
This example generates a rotation matrix that rotates a vector about the x-axis by a specified angle.
from csdl_om import Simulatorfrom csdl import Modelimport csdlimport numpy as np
class ExampleScalarRotX(Model):
def define(self): angle_val3 = np.pi / 3
angle_scalar = self.declare_variable('scalar', val=angle_val3)
# Rotation in the x-axis for scalar self.register_output('scalar_Rot_x', csdl.rotmat(angle_scalar, axis='x'))
sim = Simulator(ExampleScalarRotX())sim.run()
print('scalar', sim['scalar'].shape)print(sim['scalar'])print('scalar_Rot_x', sim['scalar_Rot_x'].shape)print(sim['scalar_Rot_x'])
[1.04719755]scalar_Rot_x (3, 3)[[ 1. 0. 0. ] [ 0. 0.5 -0.8660254] [ 0. 0.8660254 0.5 ]]